package com.fzy.core.tags;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyContent;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class ExtGridHeadTag extends BodyTagSupport {

	private static final long serialVersionUID = -7731197262072711610L;

	public int doStartTag() throws JspException {
		String html = "";
		html += "	<div style=\"overflow: auto;\">";
		html += "	<div";
		html += "		style=\"border-width: 1px; position: relative !important; width: 100%; overflow: visible;\"";
		html += "		class=\"x-grid-header-ct x-docked x-grid-header-ct-default x-docked-top x-grid-header-ct-docked-top x-grid-header-ct-default-docked-top x-box-layout-ct\">";
		html += "		<div class=\"x-box-inner \" style=\"width: 100%; height: 22px; overflow: visible;\">";
		html += "			<table style=\"overflow: visible;\" cellspace=\"0\" cellpadding=\"0\" border=\"0\">";
		try {
			pageContext.getOut().print(html);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return super.doStartTag();
	}

	public void doInitBody() throws JspException {
		super.doInitBody();
	}

	public int doAfterBody() throws JspException {
		BodyContent bodycontent = getBodyContent();
		String html = bodycontent.getString();
		try {
			bodycontent.getEnclosingWriter().print(html);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return super.doAfterBody();
	}

	public int doEndTag() throws JspException {
		String html = "";
		html += "			</table>";
		html += "		</div>";
		html += "	</div>";
		try {
			pageContext.getOut().print(html);
		} catch (IOException e) {
			e.printStackTrace();
		}
		return super.doEndTag();
	}

}
